bors [Sun, 24 Apr 2016 05:15:19 +0000 (22:15 -0700)]
Auto merge of #2610 - japaric:install-from-tempdir, r=alexcrichton
cargo-install: prefer building artifacts in the system temporary directory
and each cargo-install instance creates and uses its own build directory. This
allows running several cargo-install instances in parallel.
If we fail to create a temporary directory for whatever reason fallback to
creating and using a target-install directory in the current directory.
closes #2606
---
r? @alexcrichton
Qs:
- Should we preserve the current behavior (`target-install` in `cwd`) as a fallback or remove it and error if we can't create a `TempDir` in `env::temp_dir()`? (we currently error if we can't create `target-install` directory in `cwd`)
- Should I add tests for the issues I raised at #2606? If yes, how can I test `cargo-install` parallelism? Lack of "Blocking waiting for file lock on build directory" in the output of the `cargo` commands? or something else?
Jorge Aparicio [Sat, 23 Apr 2016 03:33:58 +0000 (22:33 -0500)]
add tests for #2606
Jorge Aparicio [Fri, 22 Apr 2016 22:49:12 +0000 (17:49 -0500)]
cargo-install: prefer building artifacts in the system temporary directory
and each cargo-install instance creates and uses its own build directory. This
allows running several cargo-install instances in parallel.
If we fail to create a temporary directory for whatever reason fallback to
creating and using a target-install directory in the current directory.
closes #2606
bors [Thu, 21 Apr 2016 18:16:01 +0000 (11:16 -0700)]
Auto merge of #2602 - durka:patch-5, r=alexcrichton
fix rerun-if-changed documentation
The documentation corresponded to the initial proposed implementation, which was changed to remove special handling of directories before it was ever merged.
closes #2599
r? @alexcrichton
Alex Burka [Thu, 21 Apr 2016 17:55:24 +0000 (13:55 -0400)]
fix rerun-if-changed documentation
The documentation corresponded to the initial proposed implementation, which was changed to remove special handling of directories before it was ever merged.
bors [Thu, 21 Apr 2016 17:40:42 +0000 (10:40 -0700)]
Auto merge of #2578 - alexcrichton:test-doc, r=brson
Add `cargo test --doc`
Supports testing only the documentation (like `--lib`, `--bin`, etc).
bors [Thu, 21 Apr 2016 17:09:27 +0000 (10:09 -0700)]
Auto merge of #2551 - alexcrichton:explain, r=brson
Add support for `cargo --explain`
The error messages in the compiler are being tweaked and will likely drop the
`rustc --explain` part of the error message in favor of `--explain`. In that
case you're expected to basically take whatever tool you're using and pass
`--explain` to it with an error code, so let's add it to Cargo as well!
Alex Crichton [Fri, 8 Apr 2016 00:27:49 +0000 (17:27 -0700)]
Add support for `cargo --explain`
The error messages in the compiler are being tweaked and will likely drop the
`rustc --explain` part of the error message in favor of `--explain`. In that
case you're expected to basically take whatever tool you're using and pass
`--explain` to it with an error code, so let's add it to Cargo as well!
bors [Thu, 21 Apr 2016 16:34:38 +0000 (09:34 -0700)]
Auto merge of #2576 - alexcrichton:silence-warnings-with-q, r=brson
Don't print warnings when -q is passed
Closes #2571
bors [Wed, 20 Apr 2016 18:51:57 +0000 (11:51 -0700)]
Auto merge of #2579 - alexcrichton:robust-submodule, r=brson
Remove submodule directory before cloning
If the directory is in a corrupt state that caused an existing repository to not
successfully open, then we'll want to blow it away anything that already exists
to ensure we start from a clean slate.
Closes #2567
bors [Wed, 20 Apr 2016 18:06:54 +0000 (11:06 -0700)]
Auto merge of #2577 - alexcrichton:doc-lib-flags, r=brson
Add `cargo doc --lib/--bin`
Allows documenting a specific target.
Closes #2557
bors [Wed, 20 Apr 2016 17:12:50 +0000 (10:12 -0700)]
Auto merge of #2560 - alexcrichton:not-all-utf8, r=brson
Don't require all build script output to be utf-8
Build scripts often stream output of native build systems like cmake/make and
those aren't always guaranteed to produce utf-8 output. For example German
MSVC cmake build has been reported to print non-utf-8 umlauts.
This commit instead only attempts to interpret each line as utf-8 rather than
the entire build script output. All non-utf-8 output is ignored.
Closes #2556
bors [Wed, 20 Apr 2016 16:09:52 +0000 (09:09 -0700)]
Auto merge of #2501 - ryanq:issue2266, r=alexcrichton
Check local targets before resolving dependencies
A call to `generate_targets(...)` before calling `resolve_dependencies()`
catches invalid target names before fetching the source for the
dependencies.
Closes #2266
bors [Tue, 19 Apr 2016 22:32:11 +0000 (15:32 -0700)]
Auto merge of #2592 - jethrogb:topic/list-symlinks, r=alexcrichton
Use stat() instead of lstat() in cargo --list
The OS-specific implementation is necessary because according to the docs, [DirEntry::metadata is fast on Windows](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.metadata). Note `is_executable` is used elsewhere so we can't change that directly to accept `DirEntry` instead of `Metadata`.
Fixes #2591
Jethro Beekman [Tue, 19 Apr 2016 20:55:37 +0000 (13:55 -0700)]
Fix dead code lints on Windows
Jethro Beekman [Tue, 19 Apr 2016 19:19:51 +0000 (12:19 -0700)]
Style issue
Jethro Beekman [Tue, 19 Apr 2016 19:00:30 +0000 (12:00 -0700)]
Add test list_command_resolves_symlinks
Jethro Beekman [Tue, 19 Apr 2016 18:59:55 +0000 (11:59 -0700)]
Tests: fix grammar and extra semicolon
Jethro Beekman [Tue, 19 Apr 2016 18:59:25 +0000 (11:59 -0700)]
Style issue
bors [Tue, 19 Apr 2016 18:46:40 +0000 (11:46 -0700)]
Auto merge of #2590 - alexcrichton:dont-warn-about-flags-and-configs, r=brson
Have CLI take preference over config for verbosity
If a CLI option is passed, that trumps any command line configuration, otherwise
just do what we did previously.
Closes #2588
Jethro Beekman [Tue, 19 Apr 2016 00:05:06 +0000 (17:05 -0700)]
Use stat() instead of lstat() in cargo --list. Fixes #2591
Alex Crichton [Mon, 18 Apr 2016 05:02:44 +0000 (22:02 -0700)]
Have CLI take preference over config for verbosity
If a CLI option is passed, that trumps any command line configuration, otherwise
just do what we did previously.
Closes #2588
bors [Mon, 18 Apr 2016 04:53:11 +0000 (21:53 -0700)]
Auto merge of #2584 - alexcrichton:auth-more, r=brson
Correctly attempt multiple usernames with libgit2
This commit corrects the logic for attempting multiple usernames with libgit2.
There is a restriction that for each authentication seession you can only
authenticate with one ssh username, but we were attempting multiple as part of
the same sesssion. Instead restart authentication whenever we try a new username.
Closes #2399
Alex Crichton [Sat, 16 Apr 2016 00:45:30 +0000 (17:45 -0700)]
Correctly attempt multiple usernames with libgit2
This commit corrects the logic for attempting multiple usernames with libgit2.
There is a restriction that for each authentication seession you can only
authenticate with one ssh username, but we were attempting multiple as part of
the same sesssion. Instead restart authentication whenever we try a new username.
Closes #2399
Alex Crichton [Sun, 17 Apr 2016 16:41:46 +0000 (09:41 -0700)]
Merge pull request #2587 from birkenfeld/docmenu
Doc dropdown menu: name "Cargo.toml" explicitly
Georg Brandl [Sun, 17 Apr 2016 06:18:55 +0000 (08:18 +0200)]
Doc dropdown menu: name "Cargo.toml" explicitly
Alex Crichton [Thu, 14 Apr 2016 17:37:16 +0000 (10:37 -0700)]
Add `cargo test --doc`
Supports testing only the documentation (like `--lib`, `--bin`, etc).
Alex Crichton [Thu, 14 Apr 2016 17:32:35 +0000 (10:32 -0700)]
Add `cargo doc --lib/--bin`
Allows documenting a specific target.
Closes #2557
Alex Crichton [Thu, 14 Apr 2016 17:40:36 +0000 (10:40 -0700)]
Remove submodule directory before cloning
If the directory is in a corrupt state that caused an existing repository to not
successfully open, then we'll want to blow it away anything that already exists
to ensure we start from a clean slate.
Closes #2567
bors [Thu, 14 Apr 2016 17:36:06 +0000 (10:36 -0700)]
Auto merge of #2575 - alexcrichton:bump, r=alexcrichton
Bump to 0.11.0
Alex Crichton [Thu, 14 Apr 2016 17:25:25 +0000 (10:25 -0700)]
Don't print warnings when -q is passed
Closes #2571
Alex Crichton [Thu, 14 Apr 2016 17:10:02 +0000 (10:10 -0700)]
Bump to 0.11.0
bors [Thu, 14 Apr 2016 17:05:05 +0000 (10:05 -0700)]
Auto merge of #2574 - alexcrichton:crates-io-bump, r=alexcrichton
Bump the crates-io crate to 0.2
Alex Crichton [Thu, 14 Apr 2016 17:04:23 +0000 (10:04 -0700)]
Bump the crates-io crate to 0.2
bors [Tue, 12 Apr 2016 15:14:33 +0000 (08:14 -0700)]
Auto merge of #2562 - smaximov:doc-add-env-vars, r=alexcrichton
Document env vars introduced in PR #2523 to the docs
Document environment variables introduced in #2523 (`CARGO_PKG_NAME`, `CARGO_PKG_DESCRIPTION`, `CARGO_PKG_HOMEPAGE`).
smaximov [Tue, 12 Apr 2016 10:32:11 +0000 (20:32 +1000)]
Add reference to env vars introduced in PR #2523 to the docs
bors [Mon, 11 Apr 2016 20:40:12 +0000 (13:40 -0700)]
Auto merge of #2561 - alexcrichton:update-tar, r=alexcrichton
Update dependency on tar
Includes a fix for alexcrichton/tar-rs#61
Alex Crichton [Mon, 11 Apr 2016 19:55:38 +0000 (12:55 -0700)]
Update dependency on tar
Includes a fix for alexcrichton/tar-rs#61
Alex Crichton [Mon, 11 Apr 2016 17:06:47 +0000 (10:06 -0700)]
Don't require all build script output to be utf-8
Build scripts often stream output of native build systems like cmake/make and
those aren't always guaranteed to produce utf-8 output. For example German
MSVC cmake build has been reported to print non-utf-8 umlauts.
This commit instead only attempts to interpret each line as utf-8 rather than
the entire build script output. All non-utf-8 output is ignored.
Closes #2556
bors [Fri, 8 Apr 2016 20:31:50 +0000 (13:31 -0700)]
Auto merge of #2554 - alexcrichton:robust-test, r=alexcrichton
Make a test a bit more robust to the environment
Don't filter out PATH as `rustc` may be in that directory (e.g. when using
rustup) and otherwise just have a longer subcommand.
Closes #2553
Alex Crichton [Fri, 8 Apr 2016 20:30:45 +0000 (13:30 -0700)]
Make a test a bit more robust to the environment
Don't filter out PATH as `rustc` may be in that directory (e.g. when using
rustup) and otherwise just have a longer subcommand.
Closes #2553
bors [Fri, 8 Apr 2016 18:53:24 +0000 (11:53 -0700)]
Auto merge of #2465 - TheNeikos:add-version_env, r=alexcrichton
Add a new CARGO_PKG_AUTHORS environment variable
This will allow crates to use the CARGO_PKG_AUTHORS env variable to get a comma
seperated list of the authors declared in the manifest.
Closes #2441
Marcel Müller [Thu, 10 Mar 2016 09:35:50 +0000 (10:35 +0100)]
Add a new CARGO_PKG_AUTHORS environment variable
This will allow crates to use the CARGO_PKG_AUTHORS env variable to get a colon
seperated list of the authors declared in the manifest.
Closes #2441
Ryan Quattlebaum [Fri, 8 Apr 2016 16:57:34 +0000 (12:57 -0400)]
Merge remote-tracking branch 'origin/master' into issue2266
Ryan Quattlebaum [Fri, 8 Apr 2016 16:55:02 +0000 (12:55 -0400)]
Only validate targets if the spec option is empty
bors [Thu, 7 Apr 2016 21:17:56 +0000 (14:17 -0700)]
Auto merge of #2385 - alexcrichton:top-level-overrides, r=wycats
Implement top-level overrides
This commit is an implementation of top-level overrides to be encoded into the
manifest itself directly. This style of override is distinct from the existing
`paths` support in `.cargo/config` in two important ways:
* Top level overrides are intended to be checked in and shared amongst all
developers of a project.
* Top level overrides are reflected in `Cargo.lock`.
The second point is crucially important here as it will ensure that an override
on one machine behaves the same as an override on another machine. This solves
many long-standing problems with `paths`-based overrides which suffer from some
level of nondeterminism as they're not encoded.
From a syntactical point of view, an override looks like:
```toml
[replace]
"libc:0.2.0" = { git = 'https://github.com/my-username/libc';, branch = '0.2-fork' }
```
This declaration indicates that whenever resolution would otherwise encounter
the `libc` package version 0.2.0 from crates.io, it should instead replace it
with the custom git dependency on a specific branch.
The key "libc:0.2.0" here is actually a package id specification which will
allow selecting various components of a graph. For example the same named
package coming from two distinct locations can be selected against, as well as
multiple versions of one crate in a dependency graph. The replacement dependency
has the same syntax as the `[dependencies]` section of Cargo.toml.
One of the major uses of this syntax will be, for example, using a temporary
fork of a crate while the changes are pushed upstream to the original repo. This
will avoid the need to change the intermediate projects immediately, and over
time once fixes have landed upstream the `[replace]` section in a `Cargo.toml`
can be removed.
There are also two crucial restrictions on overrides.
* A crate with the name `foo` can only get overridden with packages also of
the name `foo`.
* A crate can only get overridden with a crate of the exact same version.
A consequence of these restrictions is that crates.io cannot be used to replace
anything from crates.io. There's only one version of something on crates.io, so
there's nothing else to replace it with (name/version are a unique key).
Closes #942
bors [Wed, 6 Apr 2016 16:56:36 +0000 (09:56 -0700)]
Auto merge of #2547 - alexcrichton:more-locking, r=brson
Add file locks in a few more locations
One was discovered by making `target_dir` return a `Filesystem`, the other was discovered by failing tests on the nightly OSX bots.
Alex Crichton [Tue, 5 Apr 2016 23:32:13 +0000 (16:32 -0700)]
Protect against concurrent access to Cargo.lock
CI tests seen to be spurious failing on OSX due to this, I believe it's because
one process is concurrently writing out Cargo.lock while the other is trying to
read it in, so one of them gets a corrupt version.
This would ideally be fixed from `pkg.root()` returning a `Filesystem`, but that
was unfortunately such an invasive change that it seemed untenable. Additionally
we generally don't write files into the source tree, so if this is the only
instance it's perhaps not so bad trying to be robust in to the future.
Alex Crichton [Sat, 2 Apr 2016 01:06:20 +0000 (18:06 -0700)]
Change `Config::target_dir` to return Filesystem
This is a shared directory among multiple Cargo processes so access to it needs
to be properly synchronized. This commit changes the API of `Config::target_dir`
and then propagates the changes outward as necessary.
One fallout of this change is now we allow release/debug builds to proceed in
parallel.
bors [Sun, 3 Apr 2016 01:17:51 +0000 (18:17 -0700)]
Auto merge of #2541 - alexcrichton:aarch64, r=alexcrichton
Download the aarch64 standard library on the bots
Alex Crichton [Sat, 2 Apr 2016 01:08:21 +0000 (18:08 -0700)]
Download the aarch64 standard library on the bots
bors [Sat, 2 Apr 2016 23:26:03 +0000 (16:26 -0700)]
Auto merge of #2534 - alexcrichton:lock-with-git-repos, r=brson
Replace existing sources before updating
Currently sources may acquire file locks to ensure that they're not tampered
with while they're in use. We may load two sources to the same location,
however, in the case of git repositories which need to be updated. Cargo will
first load a locked version of the source and then may load an unlocked version,
and these two loads currently deadlock.
This commit tweaks the logic when updating a source to only update it after the
previous source has been replaced.
Closes #2533
bors [Sat, 2 Apr 2016 01:13:23 +0000 (18:13 -0700)]
Auto merge of #2538 - alexcrichton:aarch64, r=alexcrichton
Prepare for aarch64 nightlies and CI
Alex Crichton [Sat, 2 Apr 2016 01:08:21 +0000 (18:08 -0700)]
Prepare for aarch64 nightlies and CI
bors [Fri, 1 Apr 2016 17:56:49 +0000 (10:56 -0700)]
Auto merge of #2505 - srinivasreddy:improve_msg, r=alexcrichton
Create `Cargo.lock` if it does not exist.
Srinivas Reddy Thatiparthy [Thu, 31 Mar 2016 17:32:14 +0000 (23:02 +0530)]
remote unnecessary expression
bors [Thu, 31 Mar 2016 16:37:48 +0000 (09:37 -0700)]
Auto merge of #2491 - JIghtuse:master, r=alexcrichton
Reject manifest with duplicate dependencies in different targets
Closes #2023
srinivasreddy [Sun, 20 Mar 2016 20:12:52 +0000 (01:42 +0530)]
Generate the lock file when there is no lock file
Alex Crichton [Wed, 30 Mar 2016 17:39:24 +0000 (10:39 -0700)]
Replace existing sources before updating
Currently sources may acquire file locks to ensure that they're not tampered
with while they're in use. We may load two sources to the same location,
however, in the case of git repositories which need to be updated. Cargo will
first load a locked version of the source and then may load an unlocked version,
and these two loads currently deadlock.
This commit tweaks the logic when updating a source to only update it after the
previous source has been replaced.
Closes #2533
bors [Wed, 30 Mar 2016 16:11:39 +0000 (09:11 -0700)]
Auto merge of #2532 - japaric:musl, r=alexcrichton
install-deps.py: add x86_64-unknown-linux-musl target
This lets me build a statically linked cargo on our linux-cross Docker image with the following
commands:
$ apt-get install musl-tools # for musl-gcc, which is needed to build openssl
$ ./.travis.install.deps.sh
$ ./configure --local-rust-root=$(pwd)/rustc --enable-nightly --target=x86_64-unknown-linux-musl
$ make
$ file target/x86_64-unknown-linux-musl/release/cargo
cargo: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked (..)
---
r? @alexcrichton -- If we want start building cargo for this target on the bots, we'll have to modify the linux-cross Dockerfile to install musl-tools.
cc @eddyb
bors [Wed, 30 Mar 2016 00:43:41 +0000 (17:43 -0700)]
Auto merge of #2531 - alexcrichton:fix-stdin, r=alexcrichton
Update Rust to pick up rust-lang/rust#32257
Closes #2530
Alex Crichton [Wed, 30 Mar 2016 00:41:18 +0000 (17:41 -0700)]
Update Rust to pick up rust-lang/rust#32257
Closes #2530
Jorge Aparicio [Wed, 30 Mar 2016 00:38:13 +0000 (19:38 -0500)]
install-deps.py: add x86_64-unknown-linux-musl target
This lets me build a statically linked cargo on our linux-cross Docker image with the following
commands:
$ apt-get install musl-tools # for musl-gcc, which is needed to build openssl
$ ./.travis.install.deps.sh
$ ./configure --local-rust-root=$(pwd)/rustc --enable-nightly --target=x86_64-unknown-linux-musl
$ make
$ file target/x86_64-unknown-linux-musl/release/cargo
cargo: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked (..)
bors [Tue, 29 Mar 2016 16:48:28 +0000 (09:48 -0700)]
Auto merge of #2523 - srinivasreddy:issue-2504, r=alexcrichton
expose cargo package name as CARGO_PKG_NAME
srinivasreddy [Sat, 26 Mar 2016 20:00:26 +0000 (01:30 +0530)]
implemented cargo package name as CARGO_PKG_NAME; And package description and home page are exposed as CARGO_PKG_DESCRIPTION and CARGO_PKG_HOMEPAGE respectively. And add a test case - for CARGO_PKG_NAME, CARGO_PKR_DESCRIPTION, CARGO_HOMEPAGE.
Alex Crichton [Tue, 9 Feb 2016 23:42:17 +0000 (15:42 -0800)]
Implement top-level overrides
This commit is an implementation of top-level overrides to be encoded into the
manifest itself directly. This style of override is distinct from the existing
`paths` support in `.cargo/config` in two important ways:
* Top level overrides are intended to be checked in and shared amongst all
developers of a project.
* Top level overrides are reflected in `Cargo.lock`.
The second point is crucially important here as it will ensure that an override
on one machine behaves the same as an override on another machine. This solves
many long-standing problems with `paths`-based overrides which suffer from some
level of nondeterminism as they're not encoded.
From a syntactical point of view, an override looks like:
```toml
[replace]
"libc:0.2.0" = { git = 'https://github.com/my-username/libc', branch = '0.2-fork' }
```
This declaration indicates that whenever resolution would otherwise encounter
the `libc` package version 0.2.0 from crates.io, it should instead replace it
with the custom git dependency on a specific branch.
The key "libc:0.2.0" here is actually a package id specification which will
allow selecting various components of a graph. For example the same named
package coming from two distinct locations can be selected against, as well as
multiple versions of one crate in a dependency graph. The replacement dependency
has the same syntax as the `[dependencies]` section of Cargo.toml.
One of the major uses of this syntax will be, for example, using a temporary
fork of a crate while the changes are pushed upstream to the original repo. This
will avoid the need to change the intermediate projects immediately, and over
time once fixes have landed upstream the `[replace]` section in a `Cargo.toml`
can be removed.
There are also two crucial restrictions on overrides.
* A crate with the name `foo` can only get overridden with packages also of
the name `foo`.
* A crate can only get overridden with a crate of the exact same version.
A consequence of these restrictions is that crates.io cannot be used to replace
anything from crates.io. There's only one version of something on crates.io, so
there's nothing else to replace it with (name/version are a unique key).
Closes #942
bors [Fri, 25 Mar 2016 16:26:34 +0000 (09:26 -0700)]
Auto merge of #2519 - alexcrichton:update-curl, r=alexcrichton
Update curl-sys
Picks up a fix to hopefully and correctly configure OpenSSL to be enabled in
cross-compiled situations where OpenSSL comes from a different location
(currently specified by the `OPENSSL_ROOT_DIR` environment variable that libssh2
also reads).
Alex Crichton [Fri, 25 Mar 2016 16:24:35 +0000 (09:24 -0700)]
Update curl-sys
Picks up a fix to hopefully and correctly configure OpenSSL to be enabled in
cross-compiled situations where OpenSSL comes from a different location
(currently specified by the `OPENSSL_ROOT_DIR` environment variable that libssh2
also reads).
bors [Thu, 24 Mar 2016 16:15:04 +0000 (09:15 -0700)]
Auto merge of #2513 - alexcrichton:xcompile, r=alexcrichton
Fix nightly dist builds
* When downloading rustc, also download a number of cross-std libraries so we
can cross compile with that compiler.
* Only build OpenSSL on some --enable-nightly builds, not all. For example
Windows and OSX don't want to link statically to OpenSSL.
Alex Crichton [Thu, 24 Mar 2016 01:07:19 +0000 (18:07 -0700)]
Fix nightly dist builds
* When downloading rustc, also download a number of cross-std libraries so we
can cross compile with that compiler.
* Only build OpenSSL on some --enable-nightly builds, not all. For example
Windows and OSX don't want to link statically to OpenSSL.
bors [Wed, 23 Mar 2016 16:36:36 +0000 (09:36 -0700)]
Auto merge of #2510 - alexcrichton:xcompile, r=brson
Prepare for ARM/FreeBSD/NetBSD nightlies
This commit beefs up Cargo's makefiles to support nightly builds of Cargo for
multiple platforms. This primarily involves vendoring the logic of how to build
OpenSSL for statically linking against Cargo into the Makefiles directly. We'll
have to update the version of OpenSSL as releases are made, but we essentially
already do that with the normal docker container.
The Linux nightlies will still run in the normal dist docker container (a really
old CentOS build) and builds for new platforms will happen in the standard
linux-cross container we use for other cross builds. The nightly versions of
these will produce Cargo tarballs for a whole bunch of platforms to get
uploaded.
This has been tested in the `alexcrichton/rust-slave-linux-cross:2016-03-17b`
docker container for the 3 ARM targets and FreeBSD target. NetBSD will come once
rust-lang/rust#32407 lands.
Alex Crichton [Tue, 22 Mar 2016 21:40:00 +0000 (14:40 -0700)]
Prepare for ARM/FreeBSD/NetBSD nightlies
This commit beefs up Cargo's makefiles to support nightly builds of Cargo for
multiple platforms. This primarily involves vendoring the logic of how to build
OpenSSL for statically linking against Cargo into the Makefiles directly. We'll
have to update the version of OpenSSL as releases are made, but we essentially
already do that with the normal docker container.
The Linux nightlies will still run in the normal dist docker container (a really
old CentOS build) and builds for new platforms will happen in the standard
linux-cross container we use for other cross builds. The nightly versions of
these will produce Cargo tarballs for a whole bunch of platforms to get
uploaded.
This has been tested in the `alexcrichton/rust-slave-linux-cross:2016-03-17b`
docker container for the 3 ARM targets and FreeBSD target. NetBSD will come once
rust-lang/rust#32407 lands.
bors [Tue, 22 Mar 2016 16:52:21 +0000 (09:52 -0700)]
Auto merge of #2440 - ThinTim:master, r=alexcrichton
Prevent the use of "test" as a crate name
Fixes #2432
?r @alexcrichton
Tim Erwich [Fri, 4 Mar 2016 19:32:22 +0000 (19:32 +0000)]
Prevent the use of "test" as a crate name. Fixes #2432.
Boris Egorov [Thu, 17 Mar 2016 20:04:33 +0000 (02:04 +0600)]
Reject manifest with duplicate dependencies in different targets
Closes #2023
bors [Sat, 19 Mar 2016 18:39:35 +0000 (11:39 -0700)]
Auto merge of #2502 - IvanUkhov:doc, r=alexcrichton
doc: make the pages’ titles consistent
The titles of some of the pages end with “Cargo Documentation” (_e.g._, [Frequently Asked Questions](http://doc.crates.io/faq.html)) whereas the titles of some other pages do not (_e.g._, [Environment Variables](http://doc.crates.io/environment-variables.html)), which is a bit inconsistent. Perhaps one should either add that ending to all the titles or eliminate it from all of them. This pull request does the latter, which can be changed if needed. I personally think that such long titles are reasonable for the `title` HTML tag but a bit too verbose when displayed on the page.
Ivan Ukhov [Sat, 19 Mar 2016 06:43:49 +0000 (07:43 +0100)]
doc: make the pages’ titles consistent
Ryan Quattlebaum [Sat, 19 Mar 2016 01:28:43 +0000 (21:28 -0400)]
Check local targets before resolving dependencies
A call to generate_targets() before calling resolve_dependencies()
catches invalid target names before fetching the source for the
dependencies.
bors [Fri, 18 Mar 2016 22:02:02 +0000 (15:02 -0700)]
Auto merge of #2499 - IvanUkhov:typography, r=alexcrichton
doc/manifest: turn the list in Rules into an unordered one
Please see the comments in #2493.
Ivan Ukhov [Fri, 18 Mar 2016 18:28:45 +0000 (19:28 +0100)]
doc/manifest: turn the list in Rules into an unordered one
bors [Fri, 18 Mar 2016 18:07:20 +0000 (11:07 -0700)]
Auto merge of #2496 - alexcrichton:fix-concurrent, r=alexcrichton
Relax an assertion in the concurrent tests
The output may also have information about blocking, we just want the successful
part.
bors [Fri, 18 Mar 2016 17:49:04 +0000 (10:49 -0700)]
Auto merge of #2482 - ryanq:issue2266, r=alexcrichton
Suggest the best matching target for cargo run
Targets passed to cargo compile are validated against the package. If
the target exists, it is compiled. If not, cargo will bail and offer a
suggested target name if there is a close match.
The tests create and build/run binaries and examples using filenames
that are close (or not so close) to the target names to verify that
close matching names are suggested to the user.
Sample output attached.
<img width="838" alt="screen shot 2016-03-14 at 12 32 59 pm" src="https://cloud.githubusercontent.com/assets/124247/
13754913/
28490e42-e9ef-11e5-9617-
8d3c01106527.png">
Closes #2266
Alex Crichton [Fri, 18 Mar 2016 16:49:24 +0000 (09:49 -0700)]
Relax an assertion in the concurrent tests
The output may also have information about blocking, we just want the successful
part.
bors [Fri, 18 Mar 2016 16:47:42 +0000 (09:47 -0700)]
Auto merge of #2493 - IvanUkhov:typography, r=alexcrichton
doc/manifest: polish typography
The pull request makes a number of stylistic adjustments to The Manifest Format page. There are two commits. The first is a preliminary reflowing of paragraphs, and the second bears the actual changes. If any of the changes seems dubious, please let me know; I’ll try to motivate (and revert if needed).
Ryan Quattlebaum [Fri, 18 Mar 2016 16:39:14 +0000 (12:39 -0400)]
Fixing line length error in make test
Ryan Quattlebaum [Fri, 18 Mar 2016 16:20:36 +0000 (12:20 -0400)]
Bring in changes from master
Ryan Quattlebaum [Fri, 18 Mar 2016 16:00:22 +0000 (12:00 -0400)]
Move suggestion logic into generate_targets()
Ivan Ukhov [Fri, 18 Mar 2016 10:23:48 +0000 (11:23 +0100)]
doc/manifest: polish typography
Ivan Ukhov [Fri, 18 Mar 2016 10:06:01 +0000 (11:06 +0100)]
doc/manifest: respect 80 characters
bors [Thu, 17 Mar 2016 07:01:44 +0000 (00:01 -0700)]
Auto merge of #2467 - tshepang:rustfmt, r=alexcrichton
run rustfmt on core/source.rs
bors [Thu, 17 Mar 2016 06:43:11 +0000 (23:43 -0700)]
Auto merge of #2480 - alexcrichton:ui, r=alexcrichton
Tweak UI for warnings and errors
Right now Cargo prints out errors justified like all other status messages, but
this can look odd without coloration:
```
error some error message
```
Instead, this commit changes both warnings and errors to use the same style of:
```
error: some error message
warning: some warning message
```
Additionally, warnings now only print out "warning" in yellow instead of the
entire message (like errors do)
Alex Crichton [Sun, 13 Mar 2016 22:24:55 +0000 (15:24 -0700)]
Tweak UI for warnings and errors
Right now Cargo prints out errors justified like all other status messages, but
this can look odd without coloration:
```
error some error message
```
Instead, this commit changes both warnings and errors to use the same style of:
```
error: some error message
warning: some warning message
```
Additionally, warnings now only print out "warning" in yellow instead of the
entire message (like errors do)
Tshepang Lekhonkhobe [Thu, 10 Mar 2016 21:26:45 +0000 (23:26 +0200)]
run rustfmt on core/source.rs
Includes manual adjustments
bors [Thu, 17 Mar 2016 05:14:36 +0000 (22:14 -0700)]
Auto merge of #2486 - alexcrichton:flock, r=brson
Fix running Cargo concurrently
Cargo has historically had no protections against running it concurrently. This
is pretty unfortunate, however, as it essentially just means that you can only
run one instance of Cargo at a time **globally on a system**.
An "easy solution" to this would be the use of file locks, except they need to
be applied judiciously. It'd be a pretty bad experience to just lock the entire
system globally for Cargo (although it would work), but otherwise Cargo must be
principled how it accesses the filesystem to ensure that locks are properly
held. This commit intends to solve all of these problems.
A new utility module is added to cargo, `util::flock`, which contains two types:
* `FileLock` - a locked version of a `File`. This RAII guard will unlock the
lock on `Drop` and I/O can be performed through this object. The actual
underlying `Path` can be read from this object as well.
* `Filesystem` - an unlocked representation of a `Path`. There is no "safe"
method to access the underlying path without locking a file on the filesystem
first.
Built on the [fs2] library, these locks use the `flock` system call on Unix and
`LockFileEx` on Windows. Although file locking on Unix is [documented as not so
great][unix-bad], but largely only because of NFS, these are just advisory, and
there's no byte-range locking. These issues don't necessarily plague Cargo,
however, so we should try to leverage them. On both Windows and Unix the file
locks are released when the underlying OS handle is closed, which means that
if the process dies the locks are released.
Cargo has a number of global resources which it now needs to lock, and the
strategy is done in a fairly straightforward way:
* Each registry's index contains one lock (a dotfile in the index). Updating the
index requires a read/write lock while reading the index requires a shared
lock. This should allow each process to ensure a registry update happens while
not blocking out others for an unnecessarily long time. Additionally any
number of processes can read the index.
* When downloading crates, each downloaded crate is individually locked. A lock
for the downloaded crate implies a lock on the output directory as well.
Because downloaded crates are immutable, once the downloaded directory exists
the lock is no longer needed as it won't be modified, so it can be released.
This granularity of locking allows multiple Cargo instances to download
dependencies in parallel.
* Git repositories have separate locks for the database and for the project
checkout. The datbase and checkout are locked for read/write access when an
update is performed, and the lock of the checkout is held for the entire
lifetime of the git source. This is done to ensure that any other Cargo
processes must wait while we use the git repository. Unfortunately there's
just not that much parallelism here.
* Binaries managed by `cargo install` are locked by the local metadata file that
Cargo manages. This is relatively straightforward.
* The actual artifact output directory is just globally locked for the entire
build. It's hypothesized that running Cargo concurrently in *one directory* is
less of a feature needed rather than running multiple instances of Cargo
globally (for now at least). It would be possible to have finer grained
locking here, but that can likely be deferred to a future PR.
So with all of this infrastructure in place, Cargo is now ready to grab some
locks and ensure that you can call it concurrently anywhere at any time and
everything always works out as one might expect.
One interesting question, however, is what does Cargo do on contention? On one
hand Cargo could immediately abort, but this would lead to a pretty poor UI as
any Cargo process on the system could kick out any other. Instead this PR takes
a more nuanced approach.
* First, all locks are attempted to be acquired (a "try lock"). If this
succeeds, we're done.
* Next, Cargo prints a message to the console that it's going to block waiting
for a lock. This is done because it's indeterminate how long Cargo will wait
for the lock to become available, and most long-lasting operations in Cargo
have a message printed for them.
* Finally, a blocking acquisition of the lock is issued and we wait for it to
become available.
So all in all this should help Cargo fix any future concurrency bugs with file
locking in a principled fashion while also allowing concurrent Cargo processes
to proceed reasonably across the system.
[fs2]: https://github.com/danburkert/fs2-rs
[unix-bad]: http://0pointer.de/blog/projects/locking.html
Closes #354
Alex Crichton [Sat, 12 Mar 2016 17:58:53 +0000 (09:58 -0800)]
Fix running Cargo concurrently
Cargo has historically had no protections against running it concurrently. This
is pretty unfortunate, however, as it essentially just means that you can only
run one instance of Cargo at a time **globally on a system**.
An "easy solution" to this would be the use of file locks, except they need to
be applied judiciously. It'd be a pretty bad experience to just lock the entire
system globally for Cargo (although it would work), but otherwise Cargo must be
principled how it accesses the filesystem to ensure that locks are properly
held. This commit intends to solve all of these problems.
A new utility module is added to cargo, `util::flock`, which contains two types:
* `FileLock` - a locked version of a `File`. This RAII guard will unlock the
lock on `Drop` and I/O can be performed through this object. The actual
underlying `Path` can be read from this object as well.
* `Filesystem` - an unlocked representation of a `Path`. There is no "safe"
method to access the underlying path without locking a file on the filesystem
first.
Built on the [fs2] library, these locks use the `flock` system call on Unix and
`LockFileEx` on Windows. Although file locking on Unix is [documented as not so
great][unix-bad], but largely only because of NFS, these are just advisory, and
there's no byte-range locking. These issues don't necessarily plague Cargo,
however, so we should try to leverage them. On both Windows and Unix the file
locks are released when the underlying OS handle is closed, which means that
if the process dies the locks are released.
Cargo has a number of global resources which it now needs to lock, and the
strategy is done in a fairly straightforward way:
* Each registry's index contains one lock (a dotfile in the index). Updating the
index requires a read/write lock while reading the index requires a shared
lock. This should allow each process to ensure a registry update happens while
not blocking out others for an unnecessarily long time. Additionally any
number of processes can read the index.
* When downloading crates, each downloaded crate is individually locked. A lock
for the downloaded crate implies a lock on the output directory as well.
Because downloaded crates are immutable, once the downloaded directory exists
the lock is no longer needed as it won't be modified, so it can be released.
This granularity of locking allows multiple Cargo instances to download
dependencies in parallel.
* Git repositories have separate locks for the database and for the project
checkout. The datbase and checkout are locked for read/write access when an
update is performed, and the lock of the checkout is held for the entire
lifetime of the git source. This is done to ensure that any other Cargo
processes must wait while we use the git repository. Unfortunately there's
just not that much parallelism here.
* Binaries managed by `cargo install` are locked by the local metadata file that
Cargo manages. This is relatively straightforward.
* The actual artifact output directory is just globally locked for the entire
build. It's hypothesized that running Cargo concurrently in *one directory* is
less of a feature needed rather than running multiple instances of Cargo
globally (for now at least). It would be possible to have finer grained
locking here, but that can likely be deferred to a future PR.
So with all of this infrastructure in place, Cargo is now ready to grab some
locks and ensure that you can call it concurrently anywhere at any time and
everything always works out as one might expect.
One interesting question, however, is what does Cargo do on contention? On one
hand Cargo could immediately abort, but this would lead to a pretty poor UI as
any Cargo process on the system could kick out any other. Instead this PR takes
a more nuanced approach.
* First, all locks are attempted to be acquired (a "try lock"). If this
succeeds, we're done.
* Next, Cargo prints a message to the console that it's going to block waiting
for a lock. This is done because it's indeterminate how long Cargo will wait
for the lock to become available, and most long-lasting operations in Cargo
have a message printed for them.
* Finally, a blocking acquisition of the lock is issued and we wait for it to
become available.
So all in all this should help Cargo fix any future concurrency bugs with file
locking in a principled fashion while also allowing concurrent Cargo processes
to proceed reasonably across the system.
[fs2]: https://github.com/danburkert/fs2-rs
[unix-bad]: http://0pointer.de/blog/projects/locking.html
Closes #354
bors [Thu, 17 Mar 2016 01:12:32 +0000 (18:12 -0700)]
Auto merge of #2490 - alexcrichton:rustflags-docs, r=alexcrichton
Add docs for RUSTFLAGS and build.rustflags
bors [Thu, 17 Mar 2016 00:50:37 +0000 (17:50 -0700)]
Auto merge of #2484 - alexcrichton:fix-bad-backtrack, r=brson
Fix caching features across backtracking
In the local loop during resolution all variables need to be reset whenever we
backtrack up a frame, but currently the `method` and `features` set are
accidentally not reset whenever we backtrack. Calculate the `method` later and
cache `features` in each frame so we can properly backtrack.
Closes #2472
Alex Crichton [Thu, 17 Mar 2016 00:45:18 +0000 (17:45 -0700)]
Add docs for RUSTFLAGS and build.rustflags
bors [Thu, 17 Mar 2016 00:18:53 +0000 (17:18 -0700)]
Auto merge of #2241 - brson:rustflags, r=alexcrichton
Apply RUSTFLAGS arguments to rustc builds
Cargo will use RUSTFLAGS for building everything that is not a build script
or plugin. It does not apply to these targets because they may be for
a different platform that 'normal' builds.
Closes #2112
Alex Crichton [Mon, 14 Mar 2016 22:45:05 +0000 (15:45 -0700)]
Fix caching features across backtracking
In the local loop during resolution all variables need to be reset whenever we
backtrack up a frame, but currently the `method` and `features` set are
accidentally not reset whenever we backtrack. Calculate the `method` later and
cache `features` in each frame so we can properly backtrack.
Closes #2472